//package com.dotflat.satistics.repository.crm.impl;
//
//import com.dotflat.satistics.repository.crm.TransferContractRepository;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.stereotype.Repository;
//
//import javax.annotation.Resource;
//import java.util.List;
//import java.util.Map;
//
///**
// * *******************************
// * Created by Ron.
// * form com.matt
// * on 2018/8/2
// * *******************************
// */
//@Repository
//@Slf4j
//public class TransferContractRepositoryImpl implements TransferContractRepository {
//
//    Created by Ron
//    private JdbcTemplate crmJdbcTemplate;
//
//    @Resource(name = "teachJdbcTemplate")
//    private JdbcTemplate teachJdbcTemplate;
//
//    @Resource(name = "ssoJdbcTemplate")
//    private JdbcTemplate ssoJdbcTemplate;
//
//    @Override
//    public List<Map<String, Object>> findAllContract(Integer pageNum, Integer pageSize) {
//        List<Map<String, Object>> list = teachJdbcTemplate.queryForList("select c.id as contract_id, c.name as contract_name, c.startDate as contract_startDate, c.endDate as contract_endDate, c.duration as contract_duration, c.status as contract_status , " +
//                " c.price as contract_price, c.category as contract_category, c.createTime AS contract_created , c.remark AS contract_remark, c.durationTime as contract_durationTime," +
//                " ch.id as children_id, ch.name as children_name, ch.nickName as children_nick_name, ch.gender as  children_gender ,ch.birthday as  children_birthday, ch.address as children_address, ch.createTime as children_created, ch.aid as areaId "+
//                " from contract c left join children ch on c.cid = ch.id ORDER BY c.createTime limit ?, ?", new Object[]{pageNum * pageSize, pageSize});
//        return list;
//    }
//
//    @Override
//    public Map<String, Object> findUsersByChildrenId(String childrenId){
//        List<Map<String, Object>> list = teachJdbcTemplate.queryForList("select u.id as user_id, u.name as user_name, u.phone as user_phone, u.company as user_company, uc.relation as user_relation " +
//                " from userchildren uc left join users u on uc.uid = u.id  where uc.cid = ?", new Object[]{childrenId});
//        if (list!= null&& list.size()>0)
//            return list.get(0);
//        return null;
//    }
//
//    @Override
//    public void updateDurationTime(Double durationTime, String id) {
//        log.info("时间 [{}]", durationTime);
//
//        int count = teachJdbcTemplate.update("update contract set durationTime = ? where id=? ", new Object[]{durationTime, id});
//    }
//
//    @Override
//    public List<Map<String, Object>> findAllProduct() {
//        List<Map<String, Object>> list = crmJdbcTemplate.queryForList("select id ,name, type from product");
//        return list;
//    }
//
//    @Override
//    public Map<String, Object> findSuperAdmin(String realName) {
//        List<Map<String, Object>> list = ssoJdbcTemplate.queryForList("select s.id, s.realName, s.areaId from staff s where realName = ?", new Object[]{realName});
//        return list.size() == 0 ? null : list.get(0);
//    }
//
//    @Override
//    public void updateChildrenClienteleIdAndStaffId(String childrenId, String clienteleId, String staffId) {
//        log.info("childrenId : [{}],   clienteleId : [{}], staffId: [{}]", childrenId, clienteleId, staffId);
//        int count = teachJdbcTemplate.update("update children set crmClienteleId = ?, staffId = ? where id=? ", new Object[]{clienteleId, staffId, childrenId});
//    }
//
//
//}
